package org.parngon.maze;

import org.parngon.common.Coord;

public class Co2D implements Coord
{
  public int x;
  public int y;

  public Co2D(int x, int y)
  {
    this.x = x;
    this.y = y;
  }

  public int getDimension()
  {
    return 2;
  }

  public double distance(Coord c)
  {
    if ( c == null || !(c instanceof Co2D) ) {
      return Double.POSITIVE_INFINITY;

    }

    Co2D cc = (Co2D)c;

    return Math.sqrt((this.x - cc.x) * (this.x - cc.x) + (this.y - cc.y) * (this.y - cc.y));
  }
}
